<?php

class clienteComponent extends Component{
       
    public function show($model, $item){
        
        if(empty ($item)) return;
        extract($item);
        
        $first = end($obras);
        $this->LoadModel('tenap/segmento', 'seg');
        $seg = $this->seg->getItem($first['cod_segmento']);
        extract($seg);
        $lkk = array_key_exists('link_segmento', $_SESSION)?$_SESSION['link_segmento']:"$cod_categoria/". GetPlainName($catnome);
        $lnm = array_key_exists('link_segname' , $_SESSION)?$_SESSION['link_segname'] :$catnome;
        $this->linksnav(array(
            'Portfólio' => 'tenap/portfolio', 
            $lnm        => "tenap/segmento/show/$lkk",
            $nome       => ''
        ));
        
        $this->opendiv("", "obras");
            $this->title($nome);
            
            if(empty ($obras)){
                $this->closediv();
                return;
            }
            $this->LoadModel("tenap/segmento", 'seg');
            $cannotshow = $this->seg->getItem("Residências", 'catnome');
            $cannotshow = $cannotshow['catnome'];
            
            $this->opendiv('clientes');
            //$this->subtitle("Obras relacionadas a este cliente");
                $this->LoadComponent("galeria/album", 'galbum');
                foreach($obras as $o){
                    extract($o);
                    if($cod_segmento != $cannotshow){
                        //$capa = $this->galbum->getLinkCapa($album, "min", true);
                        //$capa = "<img src='$capa'/>";
                        //$html = "$capa<h3>$titulo</h3>";
                        $html = "<h3>$titulo</h3>";
                        $link = "tenap/obra/show/$cod_obra/". GetPlainName($titulo);
                        $this->AddItem($link, $html, "cli");
                    }
                }
            $this->closediv();
            
        $this->closediv();
    }
}

?>

<style type="text/css">
    .obras img{
        float: left;
        height: 100px;
        margin: 10px;
    }
        
    .cli{
        background: #f6f6f6;
        cursor: pointer;
        float: left;
        height: 40px;
        margin: 5px;
        min-width: 220px;
        overflow: hidden;
        width: 24%;
    }
    
            .cli:hover{
                background: #d6d6d6;
            }
    
            .cli img{
                margin: 0 5px 0 0;
                height: 80px;
            }   
</style>